import asyncio
import time
import edge_tts


async def tts(text_str,save_path) -> None:
    """Main function"""
    voice_str = 'zh-CN-XiaoxiaoNeural'
    communicate = edge_tts.Communicate(text_str, voice_str)
    await communicate.save(save_path)





if __name__ == "__main__":
    loop = asyncio.get_event_loop_policy().get_event_loop()
    try:
        loop.run_until_complete(tts('你好啊，朋友','1.mp3'))
    finally:
        loop.close()
